<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script>
    <style>
        .btn{
            position: fixed;
            top: 20px;
            left: 20px;
        }
        #html{
            width: 300px;
            height: 300px;
            background-color: aqua;
            margin-top: 1500px;
        }
        #css{
            width: 300px;
            height: 300px;
            background-color: blue;
            margin-top: 2500px;
        }
    </style>
</head>
<body>
    <p class="btn">
        <a href="#html">html</a>
        <a href="#css">css</a>
    </p>
    <div id="html">html</div>
    <div id="css">css</div>
    <script>
        $(".btn a").click(function(){
            var id = $(this).attr("href");
            var offset = $(id).offset().top;
            $("html").animate({scrollTop:offset})
        })
    </script>
</body>
</html>